#pragma once
#include "Runtime/BattleFirePrefix.h"
#include "Level.h"


namespace Alice{
    class GameInstance;
    class GameViewportClient;
    /** Specifies the goal/source of a UWorld object */
    namespace EWorldType
    {
        enum Type
        {
            /** An untyped world, in most cases this will be the vestigial worlds of streamed in sub-levels */
            None,

            /** The game world */
            Game,

            /** A world being edited in the editor */
            Editor,

            /** A Play In Editor world */
            PIE,

            /** A preview world for an editor tool */
            EditorPreview,

            /** A preview world for a game */
            GamePreview,

            /** A minimal RPC world for a game */
            GameRPC,

            /** An editor world that was loaded but not currently being edited in the level editor */
            Inactive
        };
    }
    class World{
    public:
        EWorldType::Type mWorldType;
        Level* mCurrentLevel;
        /** The interface to the scene manager for this world. */
        class SceneInterface* mScene;
        GameInstance*mGameInstance;
        GameViewportClient*mGameViewportClient;
        std::vector<ActorComponent*> mComponentsThatNeedEndOfFrameUpdate;
        void Init();
        void Tick(float inDeltaTime);
        void MarkActorComponentForNeededEndOfFrameUpdate(ActorComponent* Component, bool bForceGameThread);
        /**
         * Send all render updates to the rendering thread.
         */
        void SendAllEndOfFrameUpdates();
        /**
         * Static function that creates a new UWorld and returns a pointer to it
         */
        static World* CreateWorld(const EWorldType::Type InWorldType, bool bInformEngineOfWorld, bool bAddToRoot = true,bool bInSkipInitWorld = false);
    };
}
